<%@ page contentType="text/html;charset=UTF-8" %>
<html>
  <head>
    <title><g:message code="g.upload.title" /></title>
    <meta name="layout" content="main" />
    <g:javascript src="swfobject.js" />
    <g:javascript src="uploadify/jquery.uploadify.v2.1.0.min.js" />
    <link rel="stylesheet" href="${resource(dir:'css',file:'upload.css')}" />
    <link rel="stylesheet" href="${resource(dir:'css',file:'uploadify.css')}" />
    <script type="text/javascript">
      function uploadError(event, queueID, fileObj, errorObj) {
        alert("Type: " + errorObj.type + ". Info: " + errorObj.info);
      }

      $(document).ready(function() {
      $('#file').uploadify({
        'uploader': '${resource(dir:'swf',file:'uploadify.swf')}',
        'script': '${createLink(controller:'upload',action:'accept')}',
        'fileDesc': 'Images',
        'fileExt': '*.jpg;*.jpeg',
        'cancelImg': '${resource(dir:'images',file:'cancel.png')}',
        'queueID': 'fileQueue',
        'auto': false,
        'multi': true,
        'sizeLimit': 1024*1024*20,
        // 'onError': uploadError,
        'scriptData' : { '${uploadTicketVar}' : '${uploadTicket.uuid}' }
      });
      });
    </script>
</head>
<body>
<div class="header"><g:message code="g.upload.title" /></div>
<div class="main">
<g:form name="uploadForm" controller="upload" action="accept" method="post" enctype="multipart/form-data">
<div id="mainWrapper">
  <div id="fileQueue"></div>
  <input type="file" id="file" name="Filedata" />
  <a href="javascript:$('#file').uploadifyUpload();" class="upload"><g:message code="g.upload.upload" /></a>
</div>
</g:form>
<div style="clear:both"></div>
<br/><br/>
<g:link controller="gallery" action="index"><g:message code="g.upload.gallery" /></g:link>
</div>
</body>
</html>